/**
 * @author        Nicolas Bottarini <nicolasbottarini@gmail.com>, 404 <http://www.proyecto404.com>
 * @version       $Rev: 3 $
 * @lastrevision  $Date: 2011-09-12 16:45:37 +0000 (Mon, 12 Sep 2011) $	 
 */
package com.proyecto404.core.collections {
	import com.proyecto404.core.BaseObject;
	
	public class ArrayIterator extends BaseObject implements IIterator {
		private var _data:Array;
		private var _currentIndex:int;
		
		public function ArrayIterator(data:Array) {
			_data = data;
			
			// If the array is null, create a new empty array
			if (_data == null ) {
				_data = new Array();
			}
			_currentIndex = 0;
		}
		
		public function hasNext():Boolean {
			return _currentIndex < _data.length;
		}
		
		public function next():* {
			return _data[_currentIndex++];
		}
		
		public function reset():void {
			_currentIndex = 0;
		}
	}
}